'use strict';
import {
  StyleSheet,
  View,
  Text,
  TextInput,
  TouchableOpacity
} from 'react-native';
import React from 'react';
import Icon from 'react-native-vector-icons/Ionicons';

export default class CopyRight extends React.Component {
	constructor(props) {
	    super(props);
	    this.state = { 
	    	text: '' 
	    };
	}
	render() {
	    return (
	      	<View style={styles.Search}>
	      		<TextInput
	      			placeholder={"股票代码"}
			        style={styles.input}
			        onChangeText={(text) => this.setState({text})}
			        onSubmitEditing={()=>{this.toResult()}}
			        value={this.state.text}
			      />
			    <TouchableOpacity 
			    	style={styles.searchIcon}
                    onPress={()=>{this.toResult()}}>
	                <View>
	                	<Text style={{color:'#ffffff',alignSelf:'center'}}>搜宝</Text>
	                </View>
	            </TouchableOpacity>
	      	</View>
	    );
	}
	toResult(){
		this.props.navigator.push({
            id: 'SearchContent',
            message: {
            	userLevel:this.props.userType,
                text:this.state.text
            }
        })
	}
}

const styles = StyleSheet.create({
	Search:{
		backgroundColor:'#ffffff',
		borderColor:'#000000',
		borderBottomWidth:1,
		flexDirection:'row'
	},
	searchIcon:{
		margin:5,
		backgroundColor:'blue',
		flex: 1, 
		justifyContent: 'center'
	},
	input:{
		margin:5,
		flex:1,
		textAlign:'center',
		width:180,
		flexGrow:1,
		fontSize:14,
		color:'#e02820',
		backgroundColor: '#ffffff',
		height: 40, 
		borderColor: '#999999', 
		borderWidth: 1,
		borderRadius:3
	}
});
